Repository navigation
fix(tcp): open the receive window when the read buffer is smaller than the MTU - #5
Merged
Merged
Conversation
…n the MTU Silly-window avoidance advertised a zero window until a full MTU of space was free. With an MTU above TcpConfig::read_buffer_size (e.g. 32768 against the default 16384) that never happens, so even the SYN-ACK of an empty connection carried a zero window and normal data never flowed. Bound the threshold by half the read buffer, as RFC 1122 4.2.3.3 does; with the default MTU 1500 and 16 KiB buffer the threshold, and the behaviour, are unchanged. Raised in review of #4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the P2 review finding on #4 (
src/stream/tcp.rs): silly-window avoidance advertised a zero window until a full MTU of receive space was free. With an MTU aboveTcpConfig::read_buffer_size(e.g. 32768 against the default 16384) that can never happen, so even the SYN-ACK of an empty connection carried a zero window and data never flowed. The rule came from upstream (narrowlink#95/narrowlink#99 window work).The threshold is now
min(MTU, read_buffer_size / 2), the bound RFC 1122 §4.2.3.3 gives, computed byTcb::get_recv_window_threshold, and the comparison uses the unclamped free space. With the default MTU 1500 and 16 KiB buffer the threshold — and the behaviour — are unchanged.Test
mtu_above_the_read_buffer_still_opens_the_receive_windowopens a stream with an MTU of twice the read buffer and asserts the SYN-ACK window is non-zero; it fails on the old rule ("an empty read buffer advertised a zero window") and passes now. Theopenhelper gained an MTU-taking variant for it.Verified (nightly-2026-10-26)
fmt --check,clippy --all-targets --all-features -D warnings,test --all-features(43 unit + 23 doc).🤖 Generated with Claude Code